home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha 2008 January / Cybermycha 1_2008.iso / Data.cab / _E845796858724107BA436684501DC830 < prev    next >
Encoding:
Text File  |  2004-05-31  |  1.4 KB  |  78 lines

  1.  
  2. regc(0, "COMBINED_XFORM")
  3. regc(4, "MODEL_XFORM")
  4.  
  5. regc(12, "FOG_PARAMS")
  6.  
  7. regc(14, "CAMERA_POS_MS")
  8.  
  9. vshader("
  10.  
  11. #define point        v0
  12. #define point1        v4
  13. #define normal        v1
  14. #define tangent        v2
  15. #define tcoord        v3
  16. #define weight        v5
  17.  
  18. #define fogp    c12
  19. #define lpos    c13
  20. #define cpos    c14
  21.  
  22.     vs_1_1
  23.  
  24. #include    <fog.inc>
  25. #include    <cardef.h>
  26.  
  27.     dcl_position    point
  28.     dcl_position1    point1
  29.     dcl_normal        normal
  30.     dcl_tangent        tangent
  31.     dcl_texcoord    tcoord
  32.     dcl_blendweight weight    
  33.  
  34.     def    c20, 1, 0, SCRATCHTHRESHOLD, FRESNELSCALE
  35.  
  36.     ; morphing
  37.     mov r1, point
  38.     sub  r0, point1, r1
  39.     mad  r0, weight.x, r0, r1
  40.     ; output position
  41.     m4x4    oPos, r0, c0
  42.  
  43.     ; output texcoords
  44.     mov    oT0, tcoord           // color
  45.  
  46.     ; output DamageLevel
  47.     sge oT5.x, weight.x, c20.z
  48.     // sge oT5.x, c20.x, c20.z
  49.     ; calc tangent space basis, binormal = cross( normal, tangent )
  50.     mov    r2, tangent
  51.     mul    r3, r2.zxyw, normal.yzxw;
  52.     mad    r3, r2.yzxw, normal.zxyw, -r3
  53.  
  54.     ; output tangent -> world-space xform
  55.     dp3    oT2.x, tangent, c4
  56.     dp3    oT3.x, tangent, c5
  57.     dp3    oT4.x, tangent, c6
  58.  
  59.     dp3    oT2.y, r3, c4
  60.     dp3    oT3.y, r3, c5
  61.     dp3    oT4.y, r3, c6
  62.  
  63.     dp3    oT2.z, normal, c4
  64.     dp3    oT3.z, normal, c5
  65.     dp3    oT4.z, normal, c6
  66.  
  67.     ; E in tangent space
  68.     add    r0, cpos, -point
  69.     dp3    oT1.x, tangent, r0
  70.     dp3    oT1.y, r3, r0
  71.     dp3    oT1.z, normal, r0
  72.  
  73.     ; calc fog
  74.        dp4    r0.x, point, c2
  75.        FOG(r0.x, fogp, r10)
  76. ")
  77.  
  78.